import os

structure = {
    'pyproject': {
        'docs': None,
        'src': {
            'core': None,
            'api': None,
            'models': None,
            'services': {
                'utils': None
            },
            'config': None
        },
        'tests': {
            'unit': None,
            'integration': None
        },
        'scripts': None,
        '.gitignore': None,
        'pyproject.toml': None,
        'setup.py': None,
        'requirements.txt': None,
        'requirements-dev.txt': None,
        'README.md': None
    }
}

def create_structure(base, structure):
    for name, content in structure.items():
        path = os.path.join(base, name)
        if content is None:
            if '.' in name:  # 文件
                open(path, 'w').close()
            else:  # 空目录
                os.makedirs(path, exist_ok=True)
                # 如果是Python包则添加__init__.py
                if name in ['core', 'api', 'models', 'utils', 'config', 'unit', 'integration']:
                    open(os.path.join(path, '__init__.py'), 'w').close()
        else:
            os.makedirs(path, exist_ok=True)
            create_structure(path, content)

create_structure('.', structure)
print("项目结构已创建成功")